<template>
  <div class="dpage">
    <!-- 百度地图 -->fhfh
    <baidu-map>
      <bm-view class="map"></bm-view>
      <bm-local-search keyword="银行" :bounds="bounds" :auto-viewport="true" :panel="false"></bm-local-search>
      <bm-polygon :path="polygonPath"></bm-polygon>
    </baidu-map>
  </div>
</template>

<script>
export default {
  data() {
    return {
      pStart: {
        lng: 116.294625,
        lat: 39.961627
      },
      pEnd: {
        lng: 116.357474,
        lat: 39.988609
      }
    };
  },
  computed: {
    bounds() {
      const { pStart, pEnd } = this;
      return {
        sw: { lng: pStart.lng, lat: pStart.lat },
        ne: { lng: pEnd.lng, lat: pEnd.lat }
      };
    },
    polygonPath() {
      const { pStart, pEnd } = this;
      return [
        { lng: pStart.lng, lat: pStart.lat },
        { lng: pEnd.lng, lat: pStart.lat },
        { lng: pEnd.lng, lat: pEnd.lat },
        { lng: pStart.lng, lat: pEnd.lat }
      ];
    }
  }
};
</script>

<style>
</style>